home *** CD-ROM | disk | FTP | other *** search
/ The Mac Mega CD - Killer Software / The Mac Mega CD - Killer Software (May 1996).dmg / Shareware City / Comms. & Networking / WebStat 2.3.4DB / WebStat.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-03-28  |  1.7 KB  |  76 lines  |  [TEXT/KAHL]

  1. /*
  2. **    File:        WebStat.h
  3. **
  4. **    Author:        P. Harvey
  5. **
  6. **    Comments:    Class definitions for WebStat program
  7. */
  8.  
  9. #include <stdio.h>
  10. #include <time.h>
  11.  
  12. class Statistic {
  13. public:
  14.     Statistic();
  15.     ~Statistic();
  16.     
  17.     void    IncrStats(double byte_count);
  18.     Boolean NewVisit(time_t this_time);
  19.     void    IncrVisits(double a_one);
  20.  
  21.     unsigned long    files;
  22.     double            bytes;
  23.     char *            name;
  24.     unsigned long    visits;
  25.     time_t            that_time;
  26. };
  27.  
  28. extern "C" typedef int (*CompFunc)(const void *, const void *);
  29.  
  30. class StatList {
  31. public:
  32.     StatList(long iSize);
  33.     ~StatList();
  34.     
  35.     void            Write(FILE *fp, char *heading);
  36.     long            IncrStats(double byte_count, char *str);
  37.     Boolean            CalcVisit(time_t this_time, char *str);
  38.     void            aVisit(char *str);
  39.     long            SearchStat(char *str);
  40.     void            Substitute(char *(*func)(const char *));
  41.     void            Sort(CompFunc func=0);
  42.     static void        Summarize(FILE *fp, time_t first, time_t last);
  43.     static void        IncrTotals(double byte_count);
  44.     
  45. private:
  46.     Statistic        *stat;        // pointer to statistics table
  47.     long            num;        // number of entries in table
  48.     long            maxNum;        // number of entries allocated
  49.     long            incrSize;    // number of entries to expand by
  50.     
  51. //    static unsigned long    totalFiles;
  52.     static double            totalFiles;
  53.     static double            totalBytes;
  54.     static double            totalVisits;
  55.     static double            totalSites;
  56. };
  57.  
  58. class StringLookup {
  59. public:
  60.     StringLookup(long incr,Boolean part);
  61.     ~StringLookup();
  62.     
  63.     void            Add(char *code, char *name);
  64.     char *            Lookup(char *code);
  65.     
  66. private:
  67.     long        num;
  68.     long        maxNum;
  69.     long        incrNum;
  70.     char        **list;            // Format is "<code>\0<name>\0"
  71.     Boolean        partialCompare;
  72. };
  73.     
  74. extern "C" int CompStat(const void *p1, const void *p2);
  75. extern "C" int CompStatNum(const void *p1, const void *p2);
  76.